This page last changed on Jun 26, 2007 by aaime.

Introduction

Let's say you've just setup your data and styles in Geoserver, and you've created a nice front end with a pure javascript library like OpenLayers or MapBuilder. You're ready to tell the world about your new shiny app, there is only a catch... where do you put your static files (html files, a few icons, some javascript) so that they are served on the web?
So far you did not have a quick solution, and had to use one of the following approaches:

  1. roll your own extra web app to be deployed along with Geoserver (in the same container). This requires some java webapp setup knowledge.
  2. unpack geoserver, modify the webapp contents, repack it (ugly, making Geoserver upgrades inconvenient)
  3. use separate web server (Apache, IIS) to serve the pages (which requires some knowledge on its own).

If you application needed to make ajax calls back to Geoserver (WFS-T requires that) you would stumble into another roadblock: ajax calls are sandboxed so that you can call back only the same server that provided the page making the call. This meant that option #3 was out of the question, and an approach using some proxying (mod_proxy or similar) was required.

Serving static files directly from the data directory

Starting from Geoserver 1.5.2 and 1.6.0 you can put your own static files in the www subfolder of the GeoServer data directory, and have them served at http:/myhost:8080/geoserver/www. This means you can put there your html, images and javascript (even a full installation of MapBuilder) and have Geoserver provide them on the web: no need for unpacking, creating a new webapp, or fiddling with another web server, and no problems with ajax callback.

Now, this is handy, but has its own limitations:

  • we cannot serve files whose MIME type does not get recognized (if you get an HTTP 415 error, this is because we cannot spot your file MIME type);
  • the solution is pure java and does not make use of eventual accelerators such as the Tomcat APR library, this means if you have tons of static files to be served at high speed, you probably want to switch back to solution #1 or #3 to get optimal performance.

How do I get a MIME type added?  I'd like to post my .kml and .kmz files as well.

Posted by [email protected] at Nov 08, 2007 17:33
Document generated by Confluence on Jan 16, 2008 23:27